ds_stack_top

Reads the value from the top of the stack.

语法:

ds_stack_top(id);


参数 描述
id The id of the data structure to read from.


Returns: Real, String, undefined


描述

This function will only read the first value of the stack (that which is "on top"). It will not pop the value, meaning that it can still be read in the future by this function or the ds_stack_pop. If the stack is empty then the function will return the constant undefined, otherwise it will return the real or string value contained in the stack.


例如:

num = ds_stack_top(control_stack);

The above code will read the value from the stack indexed in the variable "control_stack" and store the return value in the variable "num".


上一页: Stacks
下一页: ds_stack_pop
© Copyright YoYo Games Ltd. 2018 All Rights Reserved